package LB2;

/**
 * Created with IntelliJ IDEA.
 * User: Борис
 * Date: 14.10.13
 * Time: 20:51
 * To change this template use File | Settings | File Templates.
 */
public class LabTwo {
    public static void main(String[] args){

        double[] interval = {1.5,1.6,1.7,1.8,1.9,2.0,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8,2.9,3.0};
        CalculateSin aCalculateSin = new CalculateSin(interval);
        double[][] gridFunction = aCalculateSin.getValuesGridFunction();
        OutputSpreadsheet spreadsheet = new OutputSpreadsheet();
        System.out.println("Сеточная функция");
        spreadsheet.printArray("x", "sin(x)", gridFunction);
        System.out.println("Первый порядок точности");
        FirstRang aFirstRang = new FirstRang(interval,0.1);
        double[][] firstDiff = aFirstRang.firstDiff();
        double[][] firstDiffSin = aCalculateSin.firstDiffSin();
        spreadsheet.printSpreadsheet("x","f'","sin'(x)",firstDiff,firstDiffSin[1]);
        System.out.println();
        double[][] secondDiff = aFirstRang.secondDiff();
        double[][] secondDiffSin = aCalculateSin.secondDiffSin();
        spreadsheet.printSpreadsheet("x","f''","sin''(x)",secondDiff,secondDiffSin[1]);
        SecondRang aSecondRang = new SecondRang(interval,0.1);
        double[][] firstDiffTwoRang = aSecondRang.firstDiff();
        System.out.println("Второй порядок точности");
        spreadsheet.printSpreadsheet("x","f'","sin'(x)",firstDiffTwoRang,firstDiffSin[1]);
        System.out.println();
        double[][] secondDiffTwoRang = aSecondRang.secondDiff();
        spreadsheet.printSpreadsheet("x","f''","sin''(x)",secondDiffTwoRang,secondDiffSin[1]);
    }
}
